<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html style='height:100%;'>
<head>
<base href="<%=basePath%>">

<title>客户审批页面</title>

<link rel="stylesheet" href="css/vivo.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="js/bootstrap2/css/bootstrap.min.css">
<link rel="stylesheet" href="js/bootstrap2/css/bootstrap-table.css">
<link rel="stylesheet" href="css/common.css">
<link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="js/webuploader-0.1.5/webuploader.css" />
<script src="js/jquery-1.11.1.js"></script>
<script src="js/bootstrap2/js/bootstrap-table.js"></script>
<script src="js/bootstrap2/js/bootstrap-table-zh-CN.js"></script>
<script src="js/bootstrap2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/layui-v2.1.5/layui/layui.all.js"></script>
<script type="text/javascript" src="js/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="js/sharefunction.js"></script>
<script src="js/select2/select2.min.js"></script>
<script src="js/form.js"></script>
<!-- 图片放大 -->
<script src="js/postbird-img-glass/postbird-img-glass.js"></script>

<style type="text/css">
form.cmxform fieldset {
	border: 1px solid #dddddd;
	background-color: white;
}

.hstyle {
	padding: 5px;
}

.clearfix:after {
	content: "\20";
	display: block;
	height: 0;
	clear: both;
	visibility: hidden
}

.clearfix {
	zoom: 1
}

.tabBar {
	border-bottom: 2px solid #222
}

.tabBar span {
	background-color: #e8e8e8;
	cursor: pointer;
	display: inline-block;
	float: left;
	font-weight: bold;
	height: 30px;
	line-height: 30px;
	padding: 0 15px
}

.tabBar span.current {
	background-color: #222;
	color: #fff
}

.tabCon {
	display: none
}

.mingcheng {
	display: -moz-inline-box;
	display: inline-block;
	width: 100px;
	text-align: right;
}

.neirong {
	width: 200px
}

.neirong2{
	display: inline-block;
    width: 250px;
}
input[type="text"] {
	height: 30px;
	margin-bottom: 0px;
}
</style>
<script type="text/javascript">
	
	$(function() {
		  //上传按钮设置为可点击0：未迁出；1：迁出
		
		$("#customerInfo").find("input,textarea").attr("readonly",true);
		$("#customerInfo .icon-fullscreen").hide();
	  	$("#customerInfo .addbtn").attr("disabled",true);
		getFiles();
		$("textarea[name='approvalRemark']").attr("readonly",false);
	  	
		//延时加载图片放大功能，图片数量多开启了异步加载
		//setTimeout("imgPlus()",2000);
		toolTip();
		//修改字段标记记录变量
		<c:set var="marks" value="原数据"/>
	});

	function imgPlus(data) {
		$.each(data, function(i, v) {
			//图片放大
			PostbirdImgGlass.init({
				domSelector : "#" + v.id + " img",
				animation : true,
				//height:'80%',
				myDocument : window.parent.parent.parent
			});

		});
		$(".uploadcancel").hide();
	}
	
	function getFiles() {
		//公司企业证件
		getFileListByFlag($("#panel0 .mCus input[name='companyId']").val(), "企业证件",2,"#list_qyzj", setRFL, imgPlus);
		//法人代表
		getFileListByFlag($("#panel0 .mCus input[name='customerId']").val(), "法人身份证",2, "#list_frsfz", setRFL, imgPlus);
		getFileListByFlag($("#panel0 .mCus input[name='customerId']").val(), "法人护照",2, "#list_frhz", setRFL, imgPlus);
		//自然人 list_zrsfz
		getFileListByFlag($("#panel1 .mCus input[name='customerId']").val(), "自然人身份证",2, "#list_zrsfz", setRFL, imgPlus);
		getFileListByFlag($("#panel1 .mCus input[name='customerId']").val(), "自然人护照",2, "#list_zrhz", setRFL, imgPlus);
		<c:if test="${requestScope.notPassExamine}"> 
		//编辑时提交的临时附件
		var fileCas=[${requestScope.companyJson}].concat([${requestScope.customerJson}]);
		if(fileCas.length > 0){
			var qyzj = "";//企业证件
			var frsfz = "";//法人身份证
			var frhz = "";//法人护照
			var zrsfz = "";//自然人身份证
			var zrhz = "";//自然人护照
			for(var i=0;i<fileCas.length;i++){
				if(fileCas[i].articleId == "企业证件"){
					qyzj += (","+fileCas[i].accessoryCAId);
				}else if(fileCas[i].articleId == "法人身份证"){
					frsfz += (","+ fileCas[i].accessoryCAId);
				}else if(fileCas[i].articleId == "法人护照"){
					frhz += (","+ fileCas[i].accessoryCAId);
				}else if(fileCas[i].articleId == "自然人身份证"){
					zrsfz += (","+ fileCas[i].accessoryCAId);
				}else if(fileCas[i].articleId == "自然人护照"){
					zrhz += (","+ fileCas[i].accessoryCAId);
				}
			}
			if(qyzj != ""){
				getFileTempList(qyzj.substring(1),"#list_qyzj", setRFL, imgPlus);
			}
			if(frsfz != ""){
				getFileTempList(frsfz.substring(1), "#list_frsfz", setRFL, imgPlus);
			}
			if(frhz != ""){
				getFileTempList(frhz.substring(1),"#list_frhz", setRFL, imgPlus);
			}
			if(zrsfz != ""){
				getFileTempList(zrsfz.substring(1),"#list_zrsfz", setRFL, imgPlus);
			}
			if(zrhz != ""){
				getFileTempList(zrhz.substring(1),"#list_zrhz", setRFL, imgPlus);
			}
			
		}
		</c:if>
	//图片放大初始化,并且每次重新上传图片时也需要初始化
	}
//设置待删除附件的值到集合中
	function setRFL(id, _this) {
	$(".uploadcancel").hide();
		layer.confirm('删除该图片？', {
			title : '警告',
			icon : 0,
			shade : [ 0.1, '#fff' ]
		}, function() {
			
			//删除指定缩略图
			$("#" + id).remove();
			layer.close(layer.index);
		});
	}

	//控制公司/个人面板显示 隐藏
	function showPanel(val) {
		$("#panel0").css("display", "none");
		$("#panel1").css("display", "none");
		if (val == "1") {
			$("#panel0").css("display", "block");
		//window.parent.$('#customer_ifr').attr('src', $('#customer_ifr').attr('src'));
		} else if (val == "2") {
			$("#panel1").css("display", "block");
		//强制刷新iframe
		//window.parent.$('#customer_ifr').attr('src', $('#customer_ifr').attr('src'));
		}
	 
	}
</script>
<body>
	<div class="page-container">
		<!-- 客户基本信息 -->
		<form class="cmxform" id="customerInfo" method="post"
			action="customerInfo/dispose">
			<input type="hidden" id="customerInfoAdd_articleId"> <input
				type="hidden" id="companyAdd_articleId">
			<div>
				<c:set var="customerType" scope="page"
					value="${empty requestScope.customerInfo1 and empty requestScope.customerInfo2 }"></c:set>
					<div>
						<div class="hstyle">
							<c:if test="${pageScope.customerType }">
							<!-- 如果是查看、编辑客户则不显示这个,如果没有查出来法人或者自然人就认为是新增 -->
								<span class="mingcheng">客户类型&nbsp;</span> <span><select
									class="js-example-placeholder-single neirong"
									name="customerType" id="customerType"
									onchange="showPanel(this.value)">
										<option value=""></option>
										<option value="1">法人</option>
										<option value="2">自然人</option>
								</select> </span>
							</c:if>
						</div>
						<div style="border-bottom: 1px solid gray; height: 35px; margin-bottom: 15px;">
							<span class="style_btn" style="width: 100px;">租赁情况</span>
						</div>
						<div class="leaseInfo" <c:if test="${pageScope.customerType }" >style="display:none;"</c:if>>
							<div class="mCus">
								<div class="hstyle">
									<span class="mingcheng">首次租期</span>
									<span>
										<input type="text" name="staLease" id="staLease" class="Wdate neirong leaseDate"
											value="<fmt:formatDate value="${requestScope.customerNew.staLease }" 
												pattern="yyyy-MM-dd"/>"
											readonly="readonly" onClick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" />
										<c:if test="${not empty requestScope.crmMap.staLease and requestScope.notPassExamine }">
											<span class="toolTip mark-msg" data-tip="<fmt:formatDate  value="${requestScope.crmMap.staLease }" type="both" pattern="yyyy-MM-dd" />">
												<c:out value="${marks}"/>
											</span>
										</c:if>
										<c:if test="${requestScope.crmMap.staLease=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg" data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span>
									<span class="mingcheng">续租终止</span>
									<span>
										<input type="text" name="endLease" class="Wdate neirong leaseDate"
											value="<fmt:formatDate 
												value="${requestScope.customerNew.endLease }" 
												pattern="yyyy-MM-dd"/>"
											readonly="readonly"
											onClick="WdatePicker({minDate:'#F{$dp.$D(\'staLease\')}',dateFmt: 'yyyy-MM-dd'})" />
										<c:if test="${not empty requestScope.crmMap.endLease and requestScope.notPassExamine }"><span class="toolTip mark-msg" data-tip="<fmt:formatDate  value="${requestScope.crmMap.endLease }" type="both" pattern="yyyy-MM-dd" />">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.crmMap.endLease=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span>
								</div>
							</div>
						</div>
					</div>
				
				<!-- 法人信息start 如果没有法人信息则隐藏-->
				<div id="panel0"
					<c:if test="${empty requestScope.customerInfo1 }" >style="display:none;"</c:if>>
					<!-- 公司信息保存在临时变量中 -->
					<c:set var="company" value="${requestScope.customerInfo1.company }"
						scope="page"></c:set>

					<div
						style="border-bottom:1px solid gray;height: 35px;margin-bottom: 15px;">
						<span class="style_btn" style="width:100px;">法人单位</span>
					</div>
					<div>
						<!-- 该div用来区分客户和相关人 -->
						<div class="mCus">
							<!-- 法人单位start -->
							<!-- <table cellpadding="10" cellspacing="5" class="mytable"> -->
							<div class="hstyle">
								<!-- 公司id -->
								<input type="hidden" name="companyId" value="${pageScope.company.id }"> 
								<span class="mingcheng">单位名称</span> 
								<span class="neirong2"><input class="input-text radius neirong" type="text" value="${pageScope.company.companyName }" name="companyName" />
										<c:if test="${not empty requestScope.map.company.companyName and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.companyName }">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.company.companyName=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
								</span>
							    <span class="mingcheng">外文名称</span> 
							    <span class="neirong2"> <input class="input-text radius neirong" type="text" value="${pageScope.company.companyEnglishName }" name="companyEnglishName" />
						       		   <c:if test="${not empty requestScope.map.company.companyEnglishName and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.companyEnglishName }">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.company.companyEnglishName=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
						        </span>
							    <span class="mingcheng">分支机构</span> 
							    <span class="neirong2"> <input class="input-text radius neirong" type="text" value="${pageScope.company.companyBranch }" name="companyBranch" />
							    		<c:if test="${not empty requestScope.map.company.companyBranch and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.companyBranch }">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.company.companyBranch=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
							    </span>
							</div>
							<div class="hstyle">
								<span class="mingcheng">企业性质</span> 
								<span class="neirong2"> <input class="input-text radius neirong" type="text" value="${pageScope.company.companyNature }" name="companyNature" />
										<c:if test="${not empty requestScope.map.company.companyNature and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.companyNature }">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.company.companyNature=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
								</span> 
								<span class="mingcheng">注册地址</span> 
								<span class="neirong2"> <input class="input-text radius neirong" type="text" value="${pageScope.company.registerAddress }" name="registerAddress" />
										<c:if test="${not empty requestScope.map.company.registerAddress and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.registerAddress }">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.company.registerAddress=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
								</span>
								<span class="mingcheng">通讯地址</span> 
								<span class="neirong2"> <input class="input-text radius neirong" type="text" value="${pageScope.company.mailingAddress }" name="mailingAddress" /> 
										<c:if test="${not empty requestScope.map.company.mailingAddress and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.mailingAddress }">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.company.mailingAddress=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
								</span>
							</div>
							<div class="hstyle">
								<span class="mingcheng">营业范围</span> 
								<span class="neirong2"> 
									<textarea style="width: 509px;height: 80px" name="businessScope" >${pageScope.company.businessScope }</textarea>
									<c:if test="${not empty requestScope.map.company.businessScope and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.businessScope }">
										<c:out value="${marks}"/></span>
									</c:if>
									<c:if test="${requestScope.map.company.businessScope=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span>
							</div>
							<div class="hstyle">
								<span class="mingcheng">企业证件</span> <span class="neirong2"> <input
									class="input-text radius neirong" type="text"
									value="${pageScope.company.companyCard }" name="companyCard" />
									<c:if test="${not empty requestScope.map.company.companyCard and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.company.companyCard }">
										<c:out value="${marks}"/></span>
									</c:if>
									<c:if test="${requestScope.map.company.companyCard=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span>
								<span> <!-- 附件上传 法人单位_企业证件 --> <!-- 上传按钮 -->
									<div id='filePicker_qyzj'
										style="display: none;vertical-align: bottom;">上传</div>
									<!-- 缩略图容器 -->
									<div id='list_qyzj' style="padding-left: 40px;"></div>
								</span>
							</div>
							<div class="hstyle">
								<span class="mingcheng">&nbsp;&nbsp;备注信息</span> 
								<span> 
									<textarea style="width:65%;" rows="3" maxlength="200" name="customerRemark" id="customerRemark" onkeydown="checkMaxInput(this,200)"  
           						 	onkeyup="checkMaxInput(this,200)" onfocus="checkMaxInput(this,200)" onblur="checkMaxInput(this,200);resetMaxmsg()">${requestScope.customerInfo1.customerRemark}</textarea>
									<c:if test="${not empty requestScope.map.customerRemark and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.customerRemark}">
										<c:out value="${marks}"/></span>
									</c:if>
									<c:if test="${requestScope.map.customerRemark=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span> 
							</div>
							<!-- 法人单位end -->
							<!-- 法人代表 start-->
							<div>
								<!-- 法人代表id -->
								<input type="hidden" name="customerId"
									value="${requestScope.customerInfo1.id }">
								<div
									style="border-bottom:1px solid gray;height: 35px;margin-bottom: 15px;">
									<span class="style_btn" style="width:100px;">法人代表</span>
								</div>
								<div class="hstyle">
									<span class="mingcheng">&nbsp;&nbsp;&nbsp;&nbsp;姓名</span> 
									<span class="neirong2"><input type="text" class="input-text radius neirong" value="${requestScope.customerInfo1.name }" name="name" /> 
										<c:if test="${not empty requestScope.map.name and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.name}">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.name=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span> 
									<span class="mingcheng">外文名称</span> 
									<span class="neirong2"> <input type="text" class="input-text radius neirong" value="${requestScope.customerInfo1.alias }" name="alias" />
										<c:if test="${not empty requestScope.map.alias and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.alias}">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.alias=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span>

								</div>
								<div class="hstyle">
									<span class="mingcheng">固定电话</span> 
									<span class="neirong2"> <input type="text" class="input-text radius neirong" value="${requestScope.customerInfo1.tel }" name="tel" /> 
										<c:if test="${not empty requestScope.map.tel and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.tel}">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.tel=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span> 
									<span class="mingcheng">&nbsp;&nbsp;手机号</span> 
									<span class="neirong2"> <input class="input-text radius neirong" type="text" value="${requestScope.customerInfo1.telMobile }" name="telMobile" /> 
										<c:if test="${not empty requestScope.map.telMobile and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.telMobile}">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.telMobile=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span> 
									<span class="mingcheng">&nbsp;&nbsp;微信号</span> 
									<span class="neirong2"> <input class="input-text radius neirong" value="${requestScope.customerInfo1.weixin }" type="text"name="weixin" /> 
										<c:if test="${not empty requestScope.map.weixin and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.weixin}">
											<c:out value="${marks}"/></span>
										</c:if>
										<c:if test="${requestScope.map.weixin=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span>
								</div>

								<div class="hstyle">
									<span class="mingcheng">&nbsp;&nbsp;QQ号</span> 
									<span class="neirong2"> <input class="input-text radius neirong" type="text" value="${requestScope.customerInfo1.qq }" name="qq" /> 
										 <c:if test="${not empty requestScope.map.qq and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.qq}">
											<c:out value="${marks}"/></span>
										 </c:if>
										 <c:if test="${requestScope.map.qq=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span> 
									<span class="mingcheng">&nbsp;&nbsp;&nbsp;&nbsp;邮箱</span> 
									<span class="neirong2"><input class="input-text radius neirong"value="${requestScope.customerInfo1.email }" type="text"name="email" /> 
										<c:if test="${not empty requestScope.map.email and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.email}">
											<c:out value="${marks}"/></span>
										 </c:if>
										 <c:if test="${requestScope.map.email=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span>
								</div>
								<div class="hstyle">
									<span class="mingcheng">&nbsp;&nbsp;身份证</span> 
									<span> <input class="input-text radius neirong"value="${requestScope.customerInfo1.idCard }" type="text"name="idCard" /> 
										 <c:if test="${not empty requestScope.map.idCard and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.idCard}">
											<c:out value="${marks}"/></span>
										 </c:if>
										 <c:if test="${requestScope.map.idCard=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span>
									<!-- 附件上传 身份证。。。-->
									<!-- 上传按钮 -->
									<div id='filePicker_frsfz'
										style="display: none;vertical-align: bottom;">上传</div>
									<!-- 缩略图容器 -->
									<div id='list_frsfz' style="padding-left: 40px;"></div>
								</div>
								<div class="hstyle">
									<span class="mingcheng">&nbsp;&nbsp;护照</span> 
									<span class="neirong2"> <input class="input-text radius neirong" value="${requestScope.customerInfo1.passport }" type="text"name="passport" /> 
										<c:if test="${not empty requestScope.map.passport and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.passport}">
											<c:out value="${marks}"/></span>
										 </c:if>
										 <c:if test="${requestScope.map.passport=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
											<c:out value="${marks}"/></span>
										</c:if>
									</span>
									<!-- 附件上传 护照。。。-->
									<!-- 上传按钮 -->
									<div id='filePicker_frhz'
										style="display: none;vertical-align: bottom;">上传</div>
									<!-- 缩略图容器 -->
									<div id='list_frhz' style="padding-left: 40px;"></div>
								</div>
								<div id="tab_demo" class="HuiTab">
									<div class="tabBar clearfix">
										<span>性情分析</span><span>交往记录</span><span>关注事项</span>
									</div>
									<div class="tabCon">性情分析</div>
									<div class="tabCon">交往记录</div>
									<div class="tabCon">关注事项</div>
								</div>
							</div>
						</div>
						<!-- 法人代表 end-->
						<!-- 新增相关人员 -->
						<div id="vant_1">
							<p style="border-bottom: 1px solid gray;padding: 5px 5px 13px 0px">
								<span class="style_btn">相关人员</span> <span class="style_input">&nbsp;&nbsp;&nbsp;&nbsp;
									<c:if test="${requestScope.map.newCorrelation == 0}"><span class="toolTip mark-msg">
										新增了相关人员</span>
									 </c:if>
								</span>
							</p>

							<c:forEach items="${requestScope.customerInfo1.correlationCustomer2 }"
								varStatus="vs" var="t">
								<!-- 展示自然人的 相关人信息,没有自动不显示 -->
								<%@include file="correlation-Customer.jsp"%>
							</c:forEach>
						</div>
						
						<c:if test="${ requestScope.notPassExamine }">
						<!-- 修改时添加变更说明 -->
						<div>
							<div style="margin:10px;" >
								审批说明：<textarea rows="3" name="approvalRemark" style="width:70%"></textarea><span style="color:red;">*</span>
							</div>
							<div style="width:100%;text-align:center; padding-top:20px">
								<!-- 保存状态 -->
								<button class="btn btn-danger radius"
									onClick="customerSubmit(true);" type="button">同意</button>
								<button class="btn btn-default radius"
									onClick="customerSubmit(false);" type="button">拒绝</button>
							</div>
						</div>
						</c:if>
					</div>
				</div>
				<!-- 法人信息end -->
				<!-- 自然人信息start 如果没有自然人则隐藏-->
				<div id="panel1"
					<c:if test="${empty requestScope.customerInfo2 }" >style="display:none"</c:if>>
					<div
						style="border-bottom:1px solid gray;height: 35px;margin-bottom: 15px;">
						<span class="style_btn" style="width:100px;">个人信息</span>
					</div>
					<div>
						<!-- 该div用来区分客户和相关人 -->
						<div class="mCus">
							<!-- 自然人id -->
							<input type="hidden" name="customerId"
								value="${requestScope.customerInfo2.id }">
							<!-- <table cellpadding="10" cellspacing="5" class="mytable"> -->
							<div class="hstyle">
								<span class="mingcheng">&nbsp;&nbsp;&nbsp;&nbsp;姓名</span> 
								<span class="neirong2">
									<input type="text" class="input-text radius neirong" value="${requestScope.customerInfo2.name }" name="name" /> <span></span>
									<c:if test="${not empty requestScope.map.name and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.name}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.name=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span> 
								<span class="mingcheng">外文名称</span> 
								<span class="neirong2"> <input type="text" class="input-text radius neirong" name="alias" value="${requestScope.customerInfo2.alias }" /> <span></span>
									<c:if test="${not empty requestScope.map.alias and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.alias}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.alias=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span>

							</div>
							<div class="hstyle">
								<span class="mingcheng">固定电话</span> 
								<span class="neirong2"> <input type="text" class="input-text radius neirong" name="tel"
									value="${requestScope.customerInfo2.tel }" /> <span
									style="color:red;"></span>
									<c:if test="${not empty requestScope.map.tel and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.tel}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.tel=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span> 
								<span class="mingcheng">&nbsp;&nbsp;手机号</span> 
								<span class="neirong2"> <input class="input-text radius neirong" type="text"
									value="${requestScope.customerInfo2.telMobile }"
									name="telMobile" /> <span style="color:red;"></span>
									<c:if test="${not empty requestScope.map.telMobile and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.telMobile}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.telMobile=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span> 
								<span class="mingcheng">&nbsp;&nbsp;微信号</span> 
								<span class="neirong2"> <input class="input-text radius neirong" type="text"
									value="${requestScope.customerInfo2.weixin }" name="weixin" />
									<span style="color:red;"></span>
									<c:if test="${not empty requestScope.map.weixin and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.weixin}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.weixin=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span>
							</div>

							<div class="hstyle">
								<span class="mingcheng">&nbsp;&nbsp;QQ号</span> 
								<span class="neirong2"> <input class="input-text radius neirong" type="text"
									value="${requestScope.customerInfo2.qq }" name="qq" /> <span></span>
									<c:if test="${not empty requestScope.map.qq and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.qq}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.qq=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span> 
								<span class="mingcheng">&nbsp;&nbsp;&nbsp;&nbsp;邮箱</span> 
								<span class="neirong2">
									<input class="input-text radius neirong" type="text"
									value="${requestScope.customerInfo2.email }" name="email" /> <span></span>
									<c:if test="${not empty requestScope.map.email and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.email}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.email=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span>
							</div>
							<div class="hstyle">
								<span class="mingcheng">&nbsp;&nbsp;身份证</span> 
								<span> <input class="input-text radius neirong"
									value="${requestScope.customerInfo2.idCard }" type="text"
									name="idCard" /> <span></span>
									<c:if test="${not empty requestScope.map.idCard and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.idCard}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.idCard=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span>
								<!-- 附件上传 身份证。。。-->
								<!-- 上传按钮 -->
								<div id='filePicker_zrsfz'
									style="display: none;vertical-align:bottom">上传</div>
								<!-- 缩略图容器 -->
								<div id='list_zrsfz' style="padding-left: 40px;"></div>
							</div>
							<div class="hstyle">
								<span class="mingcheng">&nbsp;&nbsp;护照</span> 
								<span> <input class="input-text radius neirong" type="text" name="passport"
									value="${requestScope.customerInfo2.passport }" /> <span></span>
									<c:if test="${not empty requestScope.map.passport and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.passport}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.passport=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span>
								<!-- 附件上传 护照。。。-->
								<!-- 上传按钮 -->
								<div id='filePicker_zrhz'
									style="display: none;vertical-align:bottom">上传</div>
								<!-- 缩略图容器 -->
								<div id='list_zrhz' style="padding-left: 40px;"></div>
							</div>
							<div class="hstyle">
								<span class="mingcheng">&nbsp;&nbsp;备注信息</span> 
								<span> 
									<textarea style="width:65%;" rows="3" maxlength="200" name="customerRemark" id="customerRemark" onkeydown="checkMaxInput(this,200)"  
           						 	onkeyup="checkMaxInput(this,200)" onfocus="checkMaxInput(this,200)" onblur="checkMaxInput(this,200);resetMaxmsg()">${requestScope.customerInfo2.customerRemark }</textarea>
									<c:if test="${not empty requestScope.map.customerRemark and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="${requestScope.map.customerRemark}">
										<c:out value="${marks}"/></span>
									 </c:if>
									 <c:if test="${requestScope.map.customerRemark=='' and requestScope.notPassExamine }"><span class="toolTip mark-msg"data-tip="空">
										<c:out value="${marks}"/></span>
									</c:if>
								</span> 
							</div>
							<div id="tab_demo" class="HuiTab" style="height: 100px">
								<div class="tabBar clearfix">
									<span>性情分析</span><span>交往记录</span><span>关注事项</span>
								</div>
								<div class="tabCon">性情分析</div>
								<div class="tabCon">交往记录</div>
								<div class="tabCon">关注事项</div>
							</div>
						</div>
						<!-- 新增相关人员 -->
						<div id="vant_2">
							<p style="border-bottom: 1px solid gray;padding: 5px 5px 13px 0px">
								<span class="style_btn">相关人员</span> <span class="style_input">&nbsp;&nbsp;&nbsp;&nbsp;
									
								</span>
							</p>

							<c:forEach
								items="${requestScope.customerInfo2.correlationCustomer2 }"
								varStatus="vs" var="t">
								<!-- 展示自然人的 相关人信息,没有自动不显示 -->
								<%@include file="correlation-Customer.jsp"%>
							</c:forEach>
						</div>
					</div>
					
					<c:if test="${ requestScope.notPassExamine }">
						<!-- 修改时添加变更说明 -->
						<div style="margin:10px;" >
							审批说明：<textarea rows="3" name="approvalRemark" style="width:70%"></textarea><span style="color:red;">*</span>
						</div>
						<div style="width:100%;text-align:center; padding-top:20px">
							
							<!-- 保存状态 -->
							<button class="btn btn-danger radius"
								onClick="customerSubmit(true);" type="button">同意</button>
							<button class="btn btn-default radius"
								onClick="customerSubmit(false);" type="button">拒绝</button>
						</div>
					</c:if>
				</div>
				<!-- 自然人信息end -->
			</div>
			
			<input type="hidden" name="fkRoomInfo" id="fkRoomInfo" value="${roomId }" />
			<input type="hidden" name="pendingId" id="pendingId" value="${pendingId }" />
			<input type="hidden" name="exDataId" id="exDataId" value="${exDataId }" />
			<input type="hidden" name="cType" id="cType" value="${customerNew.customerType }" />
		</form>

		<script type="text/javascript">
			var count = 0;
			
			var obj;//提交状态
			//客户类型字段
			var customerIdentity = parent.customerIdentity;
			var temp = '${requestScope.customerInfo1.customerIdentity}${requestScope.customerInfo2.customerIdentity}';
			//如果是编辑用户时就不能根据房间状态来判断该客户的类型，需要直接使用当前客户的类型
			if (temp != '') {
				customerIdentity = temp;
			}
			var customerType;
			$(function() {
				//select2 下拉菜单
				$(".js-example-placeholder-single").select2({
					placeholder : "请选择!",
					allowClear : true
				});
				$.Huitab("#tab_demo .tabBar span", "#tab_demo .tabCon", "current", "click", "1");
		
				mySubmit("customerInfo", initCustomerInfo, success3);
				initWebUpload("filePicker_qyzj", "list_qyzj", "企业证件", "companyAdd_articleId", cusstomerInfoSuccess, cusstomerInfoErr);
				initWebUpload("filePicker_frsfz", "list_frsfz", "法人身份证", "customerInfoAdd_articleId", cusstomerInfoSuccess, cusstomerInfoErr);
				initWebUpload("filePicker_frhz", "list_frhz", "法人护照", "customerInfoAdd_articleId", cusstomerInfoSuccess, cusstomerInfoErr);
				initWebUpload("filePicker_zrsfz", "list_zrsfz", "自然人身份证", "customerInfoAdd_articleId", cusstomerInfoSuccess, cusstomerInfoErr);
				initWebUpload("filePicker_zrhz", "list_zrhz", "自然人护照", "customerInfoAdd_articleId", cusstomerInfoSuccess, cusstomerInfoErr);
				
			});
			
			 //根据状态提交表单
			function customerSubmit(a) {
				obj=a;
				$("#customerInfo").submit();
			//修改状态不需要管，如果为修改 则在封装表单数据方法中会恒定给一个赋值语句
			} 
		
			jQuery.Huitab = function(tabBar, tabCon, class_name, tabEvent, i) {
				var $tab_menu = $(tabBar);
				// 初始化操作
				$tab_menu.removeClass(class_name);
				$(tabBar).eq(i).addClass(class_name);
				$(tabCon).hide();
				$(tabCon).eq(i).show();
		
				$tab_menu.bind(tabEvent, function() {
					$tab_menu.removeClass(class_name);
					$(this).addClass(class_name);
					var index = $tab_menu.index(this);
					$(tabCon).hide();
					$(tabCon).eq(index).show()
				});
			}
		
			function addRelevantDiv(obj, i) {
				//修改附件id 缩略图id 和隐藏域id
				if (count == 0) {
					$("#relevant #filePicker_xgsfz").attr('id', "filePicker_xgsfz" + count);
					$("#relevant #list_xgsfz").attr('id', "list_xgsfz" + count);
					$("#relevant #relevantAdd_articleId").attr('id', "relevantAdd_articleId" + count);
					$("#relevant #filePicker_xghz").attr('id', "filePicker_xghz" + count);
					$("#relevant #list_xghz").attr('id', "list_xghz" + count);
				} else {
					$("#relevant #filePicker_xgsfz" + (count - 1)).attr('id', "filePicker_xgsfz" + count);
					$("#relevant #list_xgsfz" + (count - 1)).attr('id', "list_xgsfz" + count);
					$("#relevant #relevantAdd_articleId" + (count - 1)).attr('id', "relevantAdd_articleId" + count);
					$("#relevant #filePicker_xghz" + (count - 1)).attr('id', "filePicker_xghz" + count);
					$("#relevant #list_xghz" + (count - 1)).attr('id', "list_xghz" + count);
				}
				var node = $("#relevant").html();
				var oTest = $("#vant_" + i);
				oTest.append(node);
				initWebUpload("filePicker_xgsfz" + count, "list_xgsfz" + count, "相关人身份证", "relevantAdd_articleId" + count, cusstomerInfoSuccess, cusstomerInfoErr);
				initWebUpload("filePicker_xghz" + count, "list_xghz" + count, "相关人护照", "relevantAdd_articleId" + count, cusstomerInfoSuccess, cusstomerInfoErr);
				
				count++;
			}
			
		
			//上传成功回调
			function cusstomerInfoSuccess(file, response) {
				PostbirdImgGlass.init({
					domSelector : "#" + file.id + " img",
					animation : true,
					//height:'80%',
					myDocument : window.parent.parent.parent
				});
			}
			//上传失败回调
			function cusstomerInfoErr(file, data) {
				//alert("上传失败回调");
			}
			//封装表单数据为json
			
			function initCustomerInfo() {
				var mli = layer.load(2);
				var exDataId = $("#exDataId").val();//序列化id
				var remark;//变更说明
				var pendingId=$("#pendingId").val();//待审批表单id
				var crmId = '${crmId}';//客户房间映射表id
				var customerType = $("#cType").val();
				if(customerType == '2'){//自然人
					remark = $("#panel1 textarea[name='approvalRemark']").val();
				}else if(customerType == '1'){//法人
					remark = $("#panel0 textarea[name='approvalRemark']").val();
				}
				if (remark == "") {
					layer.msg("审批说明不能为空");
					$("#panel0 textarea[name='approvalRemark']").focus();
					layer.close(mli);
					return null;
				}
				var formData = {
					remark : remark,//编辑时填写备注
					pendingId : pendingId,
					spflag :obj,
					exDataId:exDataId,
					crmId:crmId
				};
				return formData;
			}
		
			//成功后调用方法
			function success3(responseText) {
				//关闭加载层
				layer.close(layer.index);
				if (responseText.success) {
					layer.alert(responseText.msg, {
						offset : '20%',
						shade : [ 0.1, '#fff' ]
					}, function() {
						parent.location.reload();
						parent.parent.getPendingCount();
						parent.parent.getPendingPassCount();
						parent.parent.getPendingBackCount();
						parent.layer.closeAll();
						
		
					});
				} else {
					layer.alert(responseText.msg, {
						offset : '20%',
						shade : [ 0.1, '#fff' ]
					});
				}
			}
		</script>
	</div>
	<!-- 添加人员模板start -->
	<div id="relevant" style="display:none;">
		<div style="border:1px solid gray;padding:10px;margin:10px">
			<input type="hidden" id="relevantAdd_articleId"
				name="relevantAdd_articleId">
			<div class="hstyle">
				<span class="mingcheng">&nbsp;&nbsp;&nbsp;&nbsp;姓名</span> <span>
					<input type="text" class="input-text radius neirong" name="name" />
					<span></span>
				</span> <span class="mingcheng">外文名称</span> <span> <input
					type="text" class="input-text radius neirong" name="alias" /> <span></span>
				</span> <span style="float: right;"> <a href="javascript:void(0)"
					onclick="delRelevant(this)"> <i class="icon-fullscreen"></i>
				</a>
				</span>
			</div>
			<div class="hstyle">
				<span class="mingcheng">固定电话</span> <span> <input type="text"
					class="input-text radius neirong" name="tel" /> <span
					style="color:red;"></span>
				</span> <span class="mingcheng">&nbsp;&nbsp;手机号</span> <span> <input
					class="input-text radius neirong" type="text" name="telMobile" />
					<span style="color:red;"></span>
				</span> <span class="mingcheng">&nbsp;&nbsp;微信号</span> <span> <input
					class="input-text radius neirong" type="text" name="weixin" /> <span
					style="color:red;"></span>
				</span>
			</div>

			<div class="hstyle">
				<span class="mingcheng">&nbsp;&nbsp;QQ号</span> <span> <input
					class="input-text radius neirong" type="text" name="qq" /> <span></span>
				</span> <span class="mingcheng">&nbsp;&nbsp;&nbsp;&nbsp;邮箱</span> <span>
					<input class="input-text radius neirong" type="text" name="email" />
					<span></span>
				</span>
			</div>
			<div class="hstyle">
				<span class="mingcheng">职务</span> <span> <input
					class="input-text radius neirong" type="text" name="duty" /> <span
					style="color:red;"></span>
				</span> <span class="mingcheng">关系程度</span> <span> <input
					class="input-text radius neirong" type="text"
					name="relevancyDegree" /> <span style="color:red;"></span>
				</span> <span class="mingcheng">角色定位</span> <span> <input
					class="input-text radius neirong" type="text" name="roleDefinition" />
					<span style="color:red;"></span>
				</span>
			</div>

			<div class="hstyle">
				<span class="mingcheng">角色内容</span> <span> <input
					class="input-text radius neirong" type="text" name="roleInfo" /> <span></span>
				</span>
			</div>
			<div class="hstyle">
				<span class="mingcheng">&nbsp;&nbsp;身份证</span> <span> <input
					class="input-text radius neirong" type="text" name="idCard" /> <span></span>
				</span>
				<!-- 附件上传 身份证。。。-->
				<!-- 上传按钮 -->
				<span><div id='filePicker_xgsfz'
						style="display: none;">上传</div></span>
				<!-- 缩略图容器 -->
				<div id='list_xgsfz'></div>
			</div>
			<div class="hstyle">
				<span class="mingcheng">&nbsp;&nbsp;护照</span> <span> <input
					class="input-text radius neirong" type="text" name="passport" /> <span></span>
				</span>
				<!-- 附件上传 护照。。。-->
				<!-- 上传按钮 -->
				<div id='filePicker_xghz' style="display: none;">上传</div>
				<!-- 缩略图容器 -->
				<div id='list_xghz'></div>
			</div>
			<div id="tab_demo" class="HuiTab" style="height: 100px">
				<div class="tabBar clearfix">
					<span>性情分析</span><span>交往记录</span><span>关注事项</span>
				</div>
				<div class="tabCon">性情分析</div>
				<div class="tabCon">交往记录</div>
				<div class="tabCon">关注事项</div>
			</div>
		</div>
	</div>
	<!-- 模板end -->
</body>
</html>
